package com.whz.generic.enhance;

/**
 * @author whz
 */
public final class MsCommonClassLoader extends ClassLoader {

    private final byte[] bytes;

    public MsCommonClassLoader(ClassLoader classLoader, byte[] bytes) {
        super(classLoader);
        this.bytes = bytes.clone();
    }

    @Override
    protected Class<?> findClass(String name) throws ClassNotFoundException {
        Class<?> clz = super.defineClass(name, bytes, 0, bytes.length);
        if (clz == null) {
            clz = super.findClass(name);
        }
        return clz;
    }
}